<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div style="width: 600px;height: 400px;border: 2px solid red;" id="chart1"></div>
    <script src="./js/echarts.4.2.1.min.js"></script>
    <script>
        var option = {
            tooltip: {
                trigger: 'item',
                formatter: "{a} <br/>{b} : {c} ({d}%)"
            },
            color: ['#8fc31f', '#f35833', '#00ccff', '#ffcc00', '#f5e965', '#a74faf', '#ff9668'],

            series: [
                {
                    name: '租金构成占比(元)',
                    type: 'pie',
                    radius: '30%',
                    center: ['50%', '50%'],
                    data: [
                        { value: 435, name: '<0.5k' },
                        { value: 679, name: '0.5k-1k' },
                        { value: 848, name: '1k-2k' },
                        { value: 348, name: '2k-3k' },
                        { value: 679, name: '3k-5k' },
                        { value: 848, name: '5k-8k' },
                        { value: 1348, name: '>8k' }
                    ],
                    itemStyle: {
                        emphasis: {
                            shadowBlur: 10,
                            shadowOffsetX: 0,
                            shadowColor: 'rgba(0, 0, 0, 0.5)'
                        }
                    },
                    itemStyle: {
                        normal: {
                            label: {
                                show: true,
                                //	                            position:'inside',
                                formatter: '{b} : {c} ({d}%)',
                                fontSize: 10,    //文字的字体大小
                            }
                        },
                        labelLine: { show: true }
                    }
                }
            ]
        };
        // 使用刚指定的配置项和数据显示图表。
        var myChart = echarts.init(chart1);
        myChart.setOption(option);
    </script>
</body>

</html>